<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="jquery-3.3.1.min.js"></script>
    <script>
        $(function(){
            $("#all").click(function(){
                // 总选项 子checked和总checked一样
                $("#tb input").prop("checked",$(this).prop("checked"));
            });
            $("#tb td").find("input").click(function(){
                var ckLength = $("#tb td").find("input").length;
                console.log(ckLength);
                var checkedLength = $("#tb td :checked").length;
                console.log(checkedLength);
                $("#all").prop("checked",ckLength==checkedLength);
            });
        });
    </script>
</head>
<body>
    <table id="tb" style="border:1px solid #ccc;" rules="all"> 
        <tr style="background-color:skyblue;">
            <th><input type="checkbox" id="all"></th>
            <th>课程</th>
            <th>学院</th>
        </tr>
        <tr>
            <td><input type="checkbox"></td>
            <td>javaScript</td>
            <td>前端学院</td>
        </tr>
        <tr>
            <td><input type="checkbox"></td>
            <td>css</td>
            <td>前端学院</td>
        </tr>
        <tr>
            <td><input type="checkbox"></td>
            <td>html</td>
            <td>前端学院</td>
        </tr>
    </table>
    
</body>
</html>